/*-----------------------------------------------------------------------------
 * 
 *
 *-----------------------------------------------------------------------------
 */

#include "server/include/stock_server_gc.h"

pthread_t stock_server_gc_thread;

static uint32_t gc_time = 0;

static void
stock_server_refresh_update_rates()
{
    stock_t *stock = NULL;

    FOR_ALL_STOCKS(stock) {
        /*
         * TODO: atomic_read & atomic_clear
         */
        stock->update_rate = stock->temp_updates;
        stock->temp_updates = 0;
    }

}

void *
stock_server_gc(void *arg)
{
    while (1) {

        sleep(1);
        gc_time++;

        /*
         * 
         */
        stock_server_refresh_update_rates();


        if (gc_time % 2 == 0) {
            
        }

        if (gc_time % 60 == 0) {

        }

    }
}
